package org.nokatag.tagjava;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.nokatag.elfunction.ELFunction;

public class Inputsuper extends NokaTag{
	private static final long serialVersionUID = -3861108021469471872L;
	private String name = null;
	private String accept = null;
	private String accesskey = null;
	private String align = null;
	private String alt=null;
	private String border = null;
	private String checked = null;
	private String classstyle = null;
	private String dir = null;
	private String disabled = null;
	private String height = null;
	private String id = null;
	private String ismap = null;
	private String istyle = null;
	private String lang=null;
	private String maxlength=null;
	private String onblur=null;
	private String onchange=null;
	private String onclick=null;
	private String ondblclick=null;
	private String onfocus=null;
	private String onhelp=null;
	private String onkeydown=null;
	private String onkeyup = null;
	private String onkeypress=null;
	private String onmousedown=null;
	private String onmousemove=null;
	private String onmouseout=null;
	private String onmouseup=null;
	private String onselect=null;
	private String readonly=null;
	private String size=null;
	private String width=null;
	private String value=null;
	private String title = null;
	private String tabindex = null;
	private String style = null;
	private String src = null;
	private String placeholder=null;
	private String allownull;
	
	protected Map<String,Boolean> NOOUT=new HashMap<String,Boolean>();
	
	protected Boolean isout(String obj){
		if(NOOUT.get(obj)==null)
			return true;
		else if(NOOUT.get(obj))//为true是不输出
			return false;
		else
			return true;
	}
	
	public String getAllownull() {
		return allownull;
	}
	public void setAllownull(String allownull) {
		this.allownull = allownull;
	}
	protected String getBaseStr(){
		String basestr=" ";
		if(this.getName()!=null && isout("name"))
			basestr+=" name= \""+this.getName()+"\" ";
		if(accept!=null  && isout("accept"))
			basestr+=" accept= \""+accept+"\" ";
		if(accesskey!=null && isout("accesskey"))
			basestr+=" accesskey= \""+accesskey+"\" ";
		if(align!=null  && isout("align"))
			basestr+=" align= \""+align+"\" ";
		if(alt!=null)
			basestr+=" alt= \""+alt+" \" ";
		if(border!=null   && isout("border"))
			basestr+=" border= \""+border+"\" ";
		if(checked!=null  && isout("checked"))
			basestr+=" checked= \""+checked+"\" ";
		if(classstyle!=null  && isout("class"))
			basestr+=" class= \""+classstyle+"\" ";
		if(dir!=null  && isout("dir"))
			basestr+=" dir= \""+dir+"\" ";
		if(disabled!=null && "disabled".equals(disabled) && isout("disabled"))
			basestr+=" disabled= \""+disabled+"\" ";
		if(height!=null && isout("height"))
			basestr+=" height= \""+height+"\" ";
		if(id!=null  && isout("id"))
			basestr+=" id= \""+id+"\" ";
		if(ismap!=null  && isout("ismap"))
			basestr+=" ismap= \""+ismap+"\" ";
		if(istyle!=null  && isout("istyle"))
			basestr+=" istyle= \""+istyle+"\" ";
		if(lang!=null  && isout("lang"))
			basestr+=" lang= \""+lang+"\" ";
		if(maxlength!=null  && isout("maxlength"))
			basestr+=" maxlength= \""+maxlength+" \" ";
		//---------------------------------------------------
		if(onblur!=null  && isout("onblur"))
			basestr+=" onblur= \""+eventformat(onblur)+" \" ";
		if(onchange!=null  && isout("onchange"))
			basestr+=" onchange= \""+eventformat(onchange)+"\" ";
		if(onclick!=null  && isout("onclick"))
			basestr+=" onclick= \""+eventformat(onclick)+"\" ";
		if(ondblclick!=null  && isout("ondblclick"))
			basestr+=" ondblclick= \""+eventformat(ondblclick)+"\" ";
		if(onfocus!=null  && isout("onfocus"))
			basestr+=" onfocus= \""+eventformat(onfocus)+"\" ";
		if(onhelp!=null  && isout("onhelp"))
			basestr+=" onhelp= \""+eventformat(onhelp)+"\" ";
		if(onkeydown!=null && isout("onkeydown"))
			basestr+=" onkeydown= \""+eventformat(onkeydown)+"\" ";
		if(onkeyup!=null && isout("onkeyup"))
			basestr+=" onkeyup= \""+eventformat(onkeyup)+"\" ";
		if(onkeypress!=null  && isout("onkeypress"))
			basestr+=" onkeypress= \""+eventformat(onkeypress)+"\" ";
		if(onmousedown!=null  && isout("onmousedown"))
			basestr+=" onmousedown= \""+eventformat(onmousedown)+"\" ";
		if(onmousemove!=null  && isout("onmousemove"))
			basestr+=" onmousemove= \""+eventformat(onmousemove)+"\" ";
		if(onmouseout!=null  && isout("onmouseout"))
			basestr+=" onmouseout= \""+eventformat(onmouseout)+"\" ";
		if(onmouseup!=null  && isout("onmouseup"))
			basestr+=" onmouseup= \""+eventformat(onmouseup)+"\" ";
		if(onselect!=null  && isout("onselect"))
			basestr+=" onselect= \""+eventformat(onselect)+"\" ";
		//---------------------------------------------------
		if(readonly!=null && "readonly".equals(readonly) && isout("readonly"))
			basestr+=" readonly= \""+readonly+"\" ";
		if(size!=null  && isout("size"))
			basestr+=" size= \""+size+"\" ";
		if(width!=null  && isout("width"))
			basestr+=" width= \""+width+"\" ";
		if(value!=null  && isout("value"))
			basestr+=" value= \""+value+"\" ";
		if(title!=null  && isout("title"))
			basestr+=" title= \""+title+"\" ";
		if(tabindex!=null  && isout("tabindex"))
			basestr+=" tabindex= \""+tabindex+"\" ";
		if(style!=null  && isout("style"))
			basestr+=" style= \""+style+"\" ";
		if(src!=null  && isout("src"))
			basestr+=" src= \""+src+"\" ";
		if(placeholder!=null  && isout("placeholder"))
			basestr+=" placeholder= \""+placeholder+"\" ";
		return basestr;
	}
	private String eventformat(String event){
		if(event!=null){
			if(!event.trim().endsWith(")") && !event.trim().endsWith(");"))
					event+="()";
		}
		return event;
	}
	public String getAccept() {
		return accept;
	}
	public void setAccept(String accept) {
		this.accept = accept;
	}
	public String getAccesskey() {
		return accesskey;
	}
	public void setAccesskey(String accesskey) {
		this.accesskey = accesskey;
	}
	public String getAlign() {
		return align;
	}
	public void setAlign(String align) {
		this.align = align;
	}
	public String getAlt() {
		return alt;
	}
	public void setAlt(String alt) {
		this.alt = alt;
	}
	public String getBorder() {
		return border;
	}
	public void setBorder(String border) {
		this.border = border;
	}
	public String getChecked() {
		return checked;
	}
	public void setChecked(String checked) {
		this.checked = checked;
	}
	public String getClassstyle() {
		return classstyle;
	}
	public void setClassstyle(String classstyle) {
		this.classstyle = classstyle;
	}
	public String getDir() {
		return dir;
	}
	public void setDir(String dir) {
		this.dir = dir;
	}
	public String getDisabled() {
		return disabled;
	}
	public void setDisabled(String disabled) {
		this.disabled = disabled;
	}
	public String getHeight() {
		return height;
	}
	public void setHeight(String height) {
		this.height = height;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getIsmap() {
		return ismap;
	}
	public void setIsmap(String ismap) {
		this.ismap = ismap;
	}
	public String getIstyle() {
		return istyle;
	}
	public void setIstyle(String istyle) {
		this.istyle = istyle;
	}
	public String getLang() {
		return lang;
	}
	public void setLang(String lang) {
		this.lang = lang;
	}
	public String getMaxlength() {
		return maxlength;
	}
	public void setMaxlength(String maxlength) {
		this.maxlength = maxlength;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getOnblur() {
		return onblur;
	}
	public void setOnblur(String onblur) {
		this.onblur = onblur;
	}
	public String getOnchange() {
		return onchange;
	}
	public void setOnchange(String onchange) {
		this.onchange = onchange;
	}
	public String getOnclick() {
		return onclick;
	}
	public void setOnclick(String onclick) {
		this.onclick = onclick;
	}
	public String getOndblclick() {
		return ondblclick;
	}
	public void setOndblclick(String ondblclick) {
		this.ondblclick = ondblclick;
	}
	public String getOnfocus() {
		return onfocus;
	}
	public void setOnfocus(String onfocus) {
		this.onfocus = onfocus;
	}
	public String getOnhelp() {
		return onhelp;
	}
	public void setOnhelp(String onhelp) {
		this.onhelp = onhelp;
	}
	public String getOnkeydown() {
		return onkeydown;
	}
	public void setOnkeydown(String onkeydown) {
		this.onkeydown = onkeydown;
	}
	public String getOnkeypress() {
		return onkeypress;
	}
	public void setOnkeypress(String onkeypress) {
		this.onkeypress = onkeypress;
	}
	public String getOnmousedown() {
		return onmousedown;
	}
	public void setOnmousedown(String onmousedown) {
		this.onmousedown = onmousedown;
	}
	public String getOnmousemove() {
		return onmousemove;
	}
	public void setOnmousemove(String onmousemove) {
		this.onmousemove = onmousemove;
	}
	public String getOnmouseout() {
		return onmouseout;
	}
	public void setOnmouseout(String onmouseout) {
		this.onmouseout = onmouseout;
	}
	public String getOnmouseup() {
		return onmouseup;
	}
	public void setOnmouseup(String onmouseup) {
		this.onmouseup = onmouseup;
	}
	public String getOnselect() {
		return onselect;
	}
	public void setOnselect(String onselect) {
		this.onselect = onselect;
	}
	public String getReadonly() {
		return readonly;
	}
	public void setReadonly(String readonly) {
		this.readonly = readonly;
	}
	public String getSize() {
		return size;
	}
	public void setSize(String size) {
		this.size = size;
	}
	public String getSrc() {
		return src;
	}
	public void setSrc(String src) {
		this.src = src;
	}
	public String getStyle() {
		return style;
	}
	public void setStyle(String style) {
		this.style = style;
	}
	public String getTabindex() {
		return tabindex;
	}
	public void setTabindex(String tabindex) {
		this.tabindex = tabindex;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getValue() {
		return value;
	}
	public void setValue(String value) {
		this.value = value;
	}
	public String getWidth() {
		return width;
	}
	public void setWidth(String width) {
		this.width = width;
	}
	
	public String getRootpath(HttpServletRequest request){
		return ELFunction.rooturl(request);
	}

	public String getPlaceholder() {
		return placeholder;
	}

	public void setPlaceholder(String placeholder) {
		this.placeholder = placeholder;
	}

	public String getOnkeyup() {
		return onkeyup;
	}

	public void setOnkeyup(String onkeyup) {
		this.onkeyup = onkeyup;
	}
}
